package com.lenovo.lcdm.dcm.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lenovo.lcdm.dcm.entity.DcmBusinessConfigurationKeywords;
import com.lenovo.lcdm.dcm.mapper.DcmBusinessConfigurationKeywordsMapper;
import com.lenovo.lcdm.dcm.service.DcmBusinessConfigurationKeywordsService;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author xujing30
* @description 针对表【dcm_business_configuration_Keywords】的数据库操作Service实现
* @createDate 2024-01-22 13:31:39
*/

@Service
public class DcmBusinessConfigurationKeywordsServiceImpl extends ServiceImpl<DcmBusinessConfigurationKeywordsMapper, DcmBusinessConfigurationKeywords>
    implements DcmBusinessConfigurationKeywordsService {

    @CachePut(value = {"BusinessConfiguration"}, keyGenerator = "keywordsKeyGenerator")
    @Override
    public List<DcmBusinessConfigurationKeywords> saveBatch(List<DcmBusinessConfigurationKeywords> entityList) {
        this.saveOrUpdateBatch(entityList);
        return entityList;
    }

    @Override
    public DcmBusinessConfigurationKeywords saveKeywords(DcmBusinessConfigurationKeywords Keywords) {
        this.save(Keywords);
        return Keywords;
    }

    @Override
    public boolean deleteById(Long id) {
        return this.removeById(id);
    }

    @CacheEvict(value = {"BusinessConfiguration"}, keyGenerator = "keywordsKeyGenerator")
    @Override
    public boolean deleteAll() {
        LambdaQueryWrapper<DcmBusinessConfigurationKeywords> configurationKeywordsQw = new LambdaQueryWrapper<>();
        return this.remove(configurationKeywordsQw);
    }

    @Override
    @Cacheable(value = {"BusinessConfiguration"}, keyGenerator = "keywordsKeyGenerator")
    public List<DcmBusinessConfigurationKeywords> getAll() {
        return this.list();
    }

    @Override
    public DcmBusinessConfigurationKeywords getKeywordsById(Long id) {
        return this.getById(id);
    }
}




